<?php

class QConfig
{
    private $configName;
    private $configPath;
    private $QXC;

    /* Constructor */
    function __construct($qxc)
    {
        $this->QXC = $qxc;
    }

    /**
     * @return QConfig
     */
    public function Open($name)
    {
        $this->configName = $name;
        $this->configPath = CONFIG_DIR . '/' . strtolower($this->configName) . "." . CORE_XML_EXT;

        $this->QXC->Xml->Open($this->configPath)->ToObject(null, false, &$this);
        
        return $this;
    }

    /**
     * @return mixed
     */
    public function Get($name, $default = false)
    {
        return $this->{$name} ? $this->{$name} : $default;
    }

    /**
     * @return bool
     */
    public function Set($name, $value)
    {
        $this->{$name} = $value;
        
        return true;
    }
}